<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" id="html">
    <head>
        <title></title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <base href="<?= base_url(1); ?>" />
        <link type="text/css" href="css/main.css?v=<?= $config['version'] ?>" rel="stylesheet" />
    </head>
    <body>
        <?php include(VIEWPATH . 'common/main_header.php'); ?>
        <div class="datalist"><table id="flexigrid" style="display:none"></table></div>
        <script type="text/javascript">
            $(function() {
                $("#flexigrid").flexigrid($.extend(SG.flexOptions, {
                    url: '<?= site_url('freegift/cdkey/flexigrid') ?>',
                    colModel: [
                        {display: '<?= translate('ID') ?>', name: 'id',sortable: true, width: 140},
                        {display: '<?= translate('FREEGIFT_CDKey') ?>', name: 'keyChar', width: 140},
                        {display: '<?= translate('FREEGIFT_KEY_TYPE') ?>', name: 'keytype', width: 150},
                        {display: '<?= translate('FREEGIFT_AREAID') ?>', name: 'areaid', width: 200},                                              
                        {display: '<?= translate('STARTDATE') ?>', name: 'starttime', width: 150},
                        {display: '<?= translate('ENDDATE') ?>', name: 'endtime', width: 150},                       
                        {display: '<?= translate('FREEGIFT_OBJECTID') ?>', name: 'rewardobjectid', width: 150},
                        {display: '<?= translate('FREEGIFT_CEKEY_ISUSE') ?>', name: 'isuse', width: 100},
                        {display: '<?= translate('FREEGIFT_ROLEID') ?>', name: 'roleid', width: 100},
                        {display: '<?= translate('MANAGE') ?>', name: 'id', width: 135, sortable: false, process: formatOp, toggle: false}
                    ],
                    buttons: [
                        {name: 'add', displayname: "<?= translate('SHENGCHENG') ?>", title: "<?= translate('SHENGCHENG') ?>", bclass: 'add', onpress: multi},
                        {name: 'delete', displayname: "<?= translate('DEL') ?>", title: "<?= translate('DEL') ?>", bclass: 'delete', onpress: multi},
                        {name: 'export', displayname: "<?= translate('EXPORT') ?>", bclass: 'export', onpress: multi},
                        {separator: true}
                    ],
                    searchitems: true,
                    //sortname: "keytype,isuse",
                }));
                SG.admin = $.extend(SG.admin, {
                    add_url: '<?= site_url("freegift/cdkey/add") ?>',
                    edit_url: '<?= site_url("freegift/cdkey/edit/") ?>',
                    del_url: '<?= site_url("freegift/cdkey/del/") ?>',
                    multi_url: '<?= site_url("freegift/cdkey/multi/") ?>'
                });
            });
        </script>
    </body>
</html>